<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta id="plat_viewport" name="viewport" content="width=device-width, initial-scale=0.5, user-scalable=no, target-densitydpi=device-dpi">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>发布文章-蚂蚁搬运工</title>
    <link rel="shortcut icon" href="<?php echo base_url('file/images/mayi.ico') ?>" type="image/x-icon" />
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('file/css/wap.css') ?>">
</head>
<body>
<section class="conbg publish">
    <header class="otherbanner" id="home">
        <h1>发布文章</h1>
    </header>
    <nav id="nav" class="nav">
        <img src="<?php echo base_url('file/images/nav_img.png') ?>" width="30px">

        <ul class="nav_title">
            <li><a href="<?php echo base_url('home') ?>">首 页</a></li>
            <li><a href="<?php echo base_url('skill') ?>">技 能</a></li>
            <li><a href="<?php echo base_url('project/prolist') ?>">博 客</a></li>
            <li><a href="<?php echo base_url('movie/movielist') ?>">电 影</a></li>
            <li><a href="<?php echo base_url('photo') ?>">相 册</a></li>
            <li><a href="<?php echo base_url('team') ?>">我们团队</a></li>
            <li><a href="<?php echo base_url('about') ?>">关 于</a></li>
        </ul>
    </nav>

    <div class="othercontent" style="padding: 0">

        <div class="title_box">
            <div class="title_left">
                <input name="title" type="text" placeholder="输入标题" value="<?php if ($edit == true) {echo $project['title'];} ?>">
                <span class="title_alert">还可以输入30个字</span>
                <ul>
                    <?php for($i = 0; $i < count($protype); $i++) { ?>
                        <li value="<?php echo $protype[$i]['typeid']; ?>" class="<?php if ($edit == false && $i == 0) {echo 'bg_e0';} else {if ($edit == true) {if ($protype[$i]['typeid'] == $project['typeid']) {echo 'bg_e0';} else {echo 'bg_f0';}} else {echo 'bg_f0';};}; ?>"><img src="<?php echo base_url('file/images/share_plat1.png') ?>"><span><?php echo $protype[$i]['name']; ?></span></li>
                    <?php } ?>
                </ul>
            </div>
            <div class="title_right">//<?php if ($edit == true) {echo $project['title'];} ?>
                <img id="cover" name="cover" src="
                <?php if ($edit == true) {
                    echo base_url('images/'.$project['cover']);
                } else {
                    echo base_url('file/images/blog_img2.png');
                } ?>
                ">
                <div>
                    <span>上传封面，最佳尺寸320*200PX</span>
                    <input id="publish_cover" name="userfile" type="file" multiple="true">

                </div>
            </div>
        </div>

        <div class="content_box">
            <script id="container" name="content" type="text/plain">
<?php if ($edit == false) {echo '这里输入内容';} else {echo $project['content'];} ?>
            </script>
        </div>

        <div class="desc_box">
            <div class="desc_tit">
                <p>文章摘要</p>
                <span>还可以输入60字</span>
            </div>

            <div class="desc">
                <input name="desc" type="text" value="<?php if ($edit == true) {echo $project['prodesc'];} ?>">
            </div>
        </div>
    </div>


    <div class="publish_control">
        <div class="control_box">
            <button class="publish_post" onclick="<?php if ($edit == true) {echo 'project.edit(ue, coverstr, '.$project['proid'].')';} else {echo 'project.create(ue, coverstr)';}; ?>">发&nbsp;&nbsp;&nbsp;&nbsp;布</button>
            <button class="publish_draft">保存草稿</button>
            <span>正确发布文章？</span>
        </div>
    </div>
</section>

<script src="<?php echo base_url('file/js/wap.js') ?>" type="text/javascript" charset="utf-8"></script>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo base_url('file/js/jquery.uploadify.min.js'); ?>"></script>

<!-- 加载编辑器的容器 -->
<!-- 配置文件 -->
<script type="text/javascript" src="<?php echo base_url('ueditor/ueditor.config.js'); ?>"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="<?php echo base_url('ueditor/ueditor.all.min.js'); ?>"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    project.typeclick();
    var ue = UE.getEditor('container', {
        autoFloatEnabled: true,
        initialFrameHeight: 500
    });
    index.nav(100);
    <?php if ($edit == false) { ?>
        var coverstr = '';
    <?php } else { ?>
        var coverstr = '<?php echo $project['cover']; ?>';
        project.typeindex = <?php echo $project['typeid']; ?>;
    <?php } ?>

    $(function() {
        $('#publish_cover').uploadify({
            'swf'      : "<?php echo base_url('file/js/uploadify.swf'); ?>",
            'uploader' : "/api/do_upload",
            'fileObjName'   :   'userfile',
            'buttonText'    :   '',
            'onUploadSuccess' : function(file, data, response) {
                alert(JSON.stringify(file));
                var imgName = file['name'];
                $("#cover").attr('src', "<?php echo base_url('images/') ?>" + imgName);
                coverstr = imgName;
            },
            'onUploadError' : function(file, errorCode, errorMsg, errorString) {
                alert(errorString);
            }
        });
    });
</script>
</body>
</html>